home *** CD-ROM | disk | FTP | other *** search
/ Dos/V Magazine 1995 October 15 / CD [VMAG951015].bin / _demo / nekodemo / main / shared.dir / 00304_WinCDDA.ls < prev    next >
Encoding:
Text File  |  1995-06-01  |  3.3 KB  |  140 lines

  1. property pinpoint, poutpoint
  2.  
  3. on birth me
  4.   return me
  5. end
  6.  
  7. on mpreparemedium me
  8.   mci("open cdaudio alias drwCDAudio shareable wait")
  9.   set rcstring to the result
  10.   if voidp(rcstring) then
  11.     return -999
  12.   else
  13.     mci("status drwCDAudio mode wait")
  14.     set rcstring to the result
  15.     if (rcstring = "paused") or (rcstring = "stopped") then
  16.       return 0
  17.     else
  18.       if (rcstring = "playing") or (rcstring = "seeking") then
  19.         return 0
  20.       else
  21.         return -1
  22.       end if
  23.     end if
  24.   end if
  25. end
  26.  
  27. on mgettrackposition me, atrack
  28.   mci("status drwCDAudio position track " & string(atrack) & " wait")
  29.   return value(the result)
  30. end
  31.  
  32. on mgettracklengthprivate me, atrack
  33.   mci("status drwCDAudio length track " & string(atrack) & " wait")
  34.   return value(the result)
  35. end
  36.  
  37. on mgettrack me
  38.   mci("status drwCDAudio current track wait")
  39.   return value(the result)
  40. end
  41.  
  42. on stepFrame me
  43.   mci("status drwCDAudio mode wait")
  44.   set rcstring to the result
  45.   if (rcstring = "paused") or (rcstring = "stopped") then
  46.     mci("play drwCDAudio from " & string(the pinpoint of me) & " to " & string(the poutpoint of me))
  47.   end if
  48. end
  49.  
  50. on minitialize me
  51.   set cc to mpreparemedium(me)
  52.   mci("set drwCDAudio time format milliseconds")
  53.   mci("set drwCDAudio audio left on")
  54.   mci("set drwCDAudio audio right on")
  55.   mci("status drwCDAudio position wait")
  56.   set pos to value(the result)
  57.   set the pinpoint of me to pos
  58.   set the poutpoint of me to pos
  59.   return cc
  60. end
  61.  
  62. on mplay me, aninlist, adurationframes
  63.   if not voidp(aninlist) then
  64.     if count(aninlist) > 1 then
  65.       set inframes to getAt(aninlist, 2)
  66.       set inoffset to integer(inframes * 13.33329999999999949)
  67.     else
  68.       set inoffset to 0
  69.     end if
  70.     set track to getAt(aninlist, 1)
  71.     set intrackpos to mgettrackposition(me, track)
  72.     set inpoint to intrackpos + inoffset
  73.     set the pinpoint of me to inpoint
  74.     if voidp(adurationframes) then
  75.       set len to mgettracklengthprivate(me, track)
  76.       set outpoint to intrackpos + len
  77.     else
  78.       set outpoint to inpoint + integer(adurationframes * 13.33329999999999949)
  79.     end if
  80.     set the poutpoint of me to outpoint
  81.     set instring to " from " & inpoint
  82.   else
  83.     set instring to EMPTY
  84.   end if
  85.   mci("play drwCDAudio " & instring & " to " & string(the poutpoint of me))
  86.   return 0
  87. end
  88.  
  89. on mcancelloop me
  90.   set i to getOne(the actorList, me)
  91.   if i > 0 then
  92.     deleteAt(the actorList, i)
  93.   end if
  94. end
  95.  
  96. on mpause me
  97.   mci("pause drwCDAudio wait")
  98.   return 0 - length(the result)
  99. end
  100.  
  101. on mframesleft me
  102.   mci("status drwCDAudio position wait")
  103.   set pos to value(the result)
  104.   return integer((the poutpoint of me - pos) / 13.33329999999999949)
  105. end
  106.  
  107. on mplayloop me, aninlist, adurationframes
  108.   set cc to mplay(me, aninlist, adurationframes)
  109.   append(the actorList, me)
  110.   return cc
  111. end
  112.  
  113. on mpauseloop me
  114.   mcancelloop(me)
  115.   return mpause(me)
  116. end
  117.  
  118. on mreadstatus me
  119.   mci("status drwCDAudio mode wait")
  120.   set rcstring to the result
  121.   if (rcstring = "paused") or (rcstring = "stopped") then
  122.     return 0
  123.   else
  124.     if (rcstring = "playing") or (rcstring = "seeking") then
  125.       return 1
  126.     else
  127.       return -1
  128.     end if
  129.   end if
  130. end
  131.  
  132. on mgettracklength me, atrack
  133.   set len to mgettracklengthprivate(me, atrack)
  134.   return integer(len / 13.33329999999999949)
  135. end
  136.  
  137. on mdispose me
  138.   mci("close drwCDAudio")
  139. end
  140.